import java.util.*;

public class BiteDay37 {
/*    public static void main(String[] args) {
*//*        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int a = in.nextInt();
            int b = in.nextInt();
            System.out.println(a + b);
        }*//*
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()){
            int n = sc.nextInt();
            int ret = 0;
            int cnt = 0;
            String tmp = sc.nextLine();
            while(n-- > 0){
                String s = sc.nextLine();
                char[] arr = s.toCharArray();
                if(arr[2] == 'c'){
                    cnt++;
                    ret = Math.max(ret, cnt);
                }else{
                    cnt--;
                }
            }
            System.out.println(ret);
        }
    }*/
    static class TreeNode{
        String val;
        List<TreeNode> next;

    public TreeNode(String val) {
        this.val = val;
        next = new ArrayList<>();
    }
}

    private static void dealString(TreeNode root, String str){
        StringBuilder s = new StringBuilder(str);
        s.append('/');
        int i = 0;
        int j = 0;
        for(j = 1; j < s.length(); j++){
            if(s.charAt(j) == '/'){
                String tmp = s.substring(i, j);
                i = j;
                int flag = 0;
                for(TreeNode e : root.next){
                    if(e.val.equals(tmp)){
                        flag = 1;
                        root = e;
                    }
                }
                if(flag == 0){
                    TreeNode newNode = new TreeNode(tmp);
                    root.next.add(newNode);
                    root = newNode;
                }
            }
        }
    }

    private static void dfs(TreeNode root, List<String> ans, StringBuilder str){
        str.append(root.val);
        if(root.next.size() == 0){
            StringBuilder stringBuilder = new StringBuilder("mkdir -p ");
            stringBuilder.append(str);
            ans.add(new String(stringBuilder));
        }
        int i = 0;
        for(i = 0; i < root.next.size(); i++){
            StringBuilder tmp = new StringBuilder(str);
            dfs(root.next.get(i), ans, tmp);
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()){
            int n = sc.nextInt();
            TreeNode root = new TreeNode("");
            while(n-- > 0){
                String s = sc.next();
                dealString(root, s);
            }
            List<String> ans = new ArrayList<>();
            StringBuilder str = new StringBuilder("");
            dfs(root, ans, str);
            Collections.sort(ans);
            for(String e : ans){
                System.out.println(e);
            }
            System.out.println();
        }
    }
}
